home *** CD-ROM | disk | FTP | other *** search
- #ifndef _PARAMS
- #if defined(__STDC__) || defined(__cplusplus)
- #define _PARAMS(ARGS) ARGS
- #else
- #define _PARAMS(ARGS) ()
- #endif
- #endif /* _PARAMS */
- /* Copyright 1994-1995 The Santa Cruz Operation, Inc. All Rights Reserved. */
-
-
- #if defined(_NO_PROTOTYPE) /* Old, crufty environment */
- #include <oldstyle/tcap.h>
- #elif defined(_SCO_ODS_30) /* Old, Tbird compatible environment */
- #include <ods_30_compat/tcap.h>
- #else /* Normal, default environment */
- /*
- * Portions Copyright (C) 1983-1995 The Santa Cruz Operation, Inc.
- * All Rights Reserved.
- *
- * The information in this file is provided for the exclusive use of
- * the licensees of The Santa Cruz Operation, Inc. Such users have the
- * right to use, modify, and incorporate this code into other products
- * for purposes authorized by the license agreement provided they include
- * this notice and the associated copyright notice with any such product.
- * The information in this file is provided "AS IS" without warranty.
- */
-
- /*
- * Formerly "curses.h", now only included for termcap curses
- * (as opposed to terminfo curses).
- */
- #if defined(WINDOW) && !defined(_TCAP_H)
- #error "Please define WINDOW only via inclusion of tcap.h"
- #endif
-
- #ifndef _TCAP_H
- #define _TCAP_H
-
- #pragma comment(exestr, "xpg4plus @(#) tcap.h 20.1 94/12/04 ")
-
- #pragma pack(4)
-
- #include <stdio.h>
- #include <termio.h>
- #include <unctrl.h>
-
- typedef struct termio SGTTY;
- typedef unsigned long chtype;
-
- #define bool char
- #define reg register
-
- #define TRUE 1
- #define FALSE 0
- #define ERR 0
- #define OK (1)
-
- #define _ENDLINE 001
- #define _FULLWIN 002
- #define _SCROLLWIN 004
- #define _FLUSH 010
- #define _CUROFF 020
- #define _VSCROLL 040
-
- #define A_CHARTEXT 0x00ff
- #define A_ATTRIBUTES 0xff00
- #define A_STANDOUT 0x0100
- #define A_BLINK 0x0200
- #define A_UNDERLINE 0x0400
- #define A_ATTR4 0x0800 /* USER DEFINED */
- #define A_ATTR5 0x1000 /* USER DEFINED */
- #define A_ATTR6 0x2000 /* USER DEFINED */
- #define A_ATTR7 0x4000 /* USER DEFINED */
- #define A_ATTR8 0x8000 /* USER DEFINED */
-
- /* for compatibility */
-
- #define _ATTRIBUTE A_ATTRIBUTES
- #define _STANDOUT A_STANDOUT /* STANDOUT */
- #define _BLINK A_BLINK /* BLINK */
- #define _UNDERLIN A_UNDERLINE /* UNDERLINE */
- #define ATTR1 A_STANDOUT /* STANDOUT */
- #define ATTR2 A_BLINK /* BLINK */
- #define ATTR3 A_UNDERLINE /* UNDERLINE */
- #define ATTR4 A_ATTR4
- #define ATTR5 A_ATTR5
- #define ATTR6 A_ATTR6
- #define ATTR7 A_ATTR7
- #define ATTR8 A_ATTR8
-
- #define _NOCHANGE (-1)
- #define _DELETE (-1 & 0x8000)
- #define _INSERT (-1 & 0xC000)
- #define _INSDEL (-1 & 0xE000)
-
- #define _puts(s) tputs(s, 1, tputch)
-
- /*
- * Capabilities from termcap
- */
-
- #if __cplusplus
- extern "C" {
- #endif /* __cplusplus */
-
- extern bool AM, BS, CA, DA, DB, EO, GT, HZ, IN, MI, MS, NC, OS, UL,
- XN, XS;
- extern char *KK1, *KK2, *KK3, *KK4, *KK5, *AL, *BC, *BL, *BT, *CD,
- *CE, *CF, *CL, *CM, *CO, *CR, *DC, *DL, *DM, *DO,
- *ED, *EI, *EN, *HO, *IC, *IM, *IP, *K0, *K1, *K2, *K3,
- *K4, *K5, *K6, *K7, *K8, *K9, *KAA, *KCC, *KDD, *KEE,
- *KFF, *KHH, *KII, *KLL, *KMM, *KNN, *KPP, *KRR, *KSS, *KTT,
- *KA, *KB, *KD, *KE, *KH, *KL, *KR, *KS, *KT, *KU,
- *LL, *MA, *MB, *ME, *ND, *NL, *SE, *SF, *SO, *SR,
- *TA, *TE, *TI, *UC, *UE, *UP, *US, *VB, *VE, *VS,
- *BB, *BE, PC;
- extern char *A4S, *A4E,*A5S, *A5E, *A6S, *A6E, *A7S, *A7E, *A8S, *A8E;
- extern int A4G, A5G, A6G, A7G, A8G, SG, UG;
-
- /*
- * From the tty modes...
- */
-
- extern bool NONL, UPPERCASE, normtty, _pfast;
- #if __cplusplus
- };
- #endif /* __cplusplus */
-
- struct _win_st {
- short _cury, _curx;
- short _maxy, _maxx;
- short _begy, _begx;
- short _flags;
- bool _clear;
- bool _leave;
- bool _scroll;
- bool _keypad; /* Sys V Release 2 */
- short **_y;
- short *_ybase;
- short *_firstch;
- short *_lastch;
- struct _win_st *_nextp, *_orig;
- };
-
- #define WINDOW struct _win_st
-
- #if __cplusplus
- extern "C" {
- #endif /* __cplusplus */
-
- extern WINDOW *initscr(), *newwin _PARAMS((int, int, int, int)), *subwin _PARAMS((WINDOW *, int, int, int, int));
- extern char *longname(), *getcap();
-
- extern bool My_term, _echoit, _rawmode, _kpadmode, _endwin;
-
- extern char *Def_term, ttytype[];
-
- extern int LINES, COLS, _tty_ch, _res_flg;
-
- extern SGTTY _tty;
-
- extern WINDOW *stdscr, *curscr;
-
- #if __cplusplus
- };
- #endif /* __cplusplus */
-
- /*
- * Define CURVOID to stop lint from generating "null effect"
- * comments.
- */
- #ifdef __lint
- int __void__;
- #define CURVOID(x) (__void__ = (int) (x))
- #else
- #define CURVOID(x) (x)
- #endif
-
- /*
- * psuedo functions for standard screen
- */
- #define addch(ch) CURVOID(waddch(stdscr, ch))
- #define getch() CURVOID(wgetch(stdscr))
- #define addstr(str) CURVOID(waddstr(stdscr, str))
- #define getstr(str) CURVOID(wgetstr(stdscr, str))
- #define move(y, x) CURVOID(wmove(stdscr, y, x))
- #define clear() CURVOID(wclear(stdscr))
- #define erase() CURVOID(werase(stdscr))
- #define clrtobot() CURVOID(wclrtobot(stdscr))
- #define clrtoeol() CURVOID(wclrtoeol(stdscr))
- #define insertln() CURVOID(winsertln(stdscr))
- #define deleteln() CURVOID(wdeleteln(stdscr))
- #define refresh() CURVOID(wrefresh(stdscr))
- #define inch() CURVOID(winch(stdscr))
- #define insch(c) CURVOID(winsch(stdscr,c))
- #define delch() CURVOID(wdelch(stdscr))
-
- #define attron(a) CURVOID(wattron(stdscr,a))
- #define attroff(a) CURVOID(wattroff(stdscr,a))
- #define attrset(a) CURVOID(wattrset(stdscr,a))
- #define standout() CURVOID(wattron(stdscr,A_STANDOUT))
- #define standend() CURVOID(wattroff(stdscr,A_STANDOUT))
- #define wstandout(win) CURVOID(wattron(win,A_STANDOUT))
- #define wstandend(win) CURVOID(wattroff(win,A_STANDOUT))
-
- /*
- * mv functions
- */
- #define mvwaddch(win,y,x,ch) CURVOID(wmove(win,y,x)==ERR?ERR:waddch(win,ch))
- #define mvwgetch(win,y,x) CURVOID(wmove(win,y,x)==ERR?ERR:wgetch(win))
- #define mvwaddstr(win,y,x,str) CURVOID(wmove(win,y,x)==ERR?ERR:waddstr(win,str))
- #define mvwgetstr(win,y,x,str) CURVOID(wmove(win,y,x)==ERR?ERR:wgetstr(win,str))
- #define mvwinch(win,y,x) CURVOID(wmove(win,y,x) == ERR ? ERR : winch(win))
- #define mvwdelch(win,y,x) CURVOID(wmove(win,y,x) == ERR ? ERR : wdelch(win))
- #define mvwinsch(win,y,x,c) CURVOID(wmove(win,y,x) == ERR ? ERR:winsch(win,c))
- #define mvaddch(y,x,ch) mvwaddch(stdscr,y,x,ch)
- #define mvgetch(y,x) mvwgetch(stdscr,y,x)
- #define mvaddstr(y,x,str) mvwaddstr(stdscr,y,x,str)
- #define mvgetstr(y,x,str) mvwgetstr(stdscr,y,x,str)
- #define mvinch(y,x) mvwinch(stdscr,y,x)
- #define mvdelch(y,x) mvwdelch(stdscr,y,x)
- #define mvinsch(y,x,c) mvwinsch(stdscr,y,x,c)
-
- /*
- * psuedo functions
- */
- #define clearok(win,bf) (win->_clear = bf)
- #define leaveok(win,bf) (win->_leave = bf)
- #define scrollok(win,bf) (win->_scroll = bf)
- #define keypad(win,bf) (win->_keypad = bf)
- #define flushok(win,bf) (bf ? (win->_flags |= _FLUSH):(win->_flags &= ~_FLUSH))
- #define tscroll(win,bf) (bf ? (win->_flags |= _VSCROLL):(win->_flags &= ~_VSCROLL))
- #define autoflush(bf) (bf ? (curscr->_flags |= _FLUSH):(curscr->_flags &= ~_FLUSH))
- #define getyx(win,y,x) y = win->_cury, x = win->_curx
- #define getorg(win,y,x) y = win->_begy, x = win->_begx
- #define getdim(win,y,x) y = win->_maxy, x = win->_maxx
- #define is_standout(win) (win->_flags & A_STANDOUT)
- #define is_blinkon(win) (win->_flags & A_BLINK)
- #define is_underlin(win) (win->_flags & A_UNDERLINE)
- #define is_attr1on(win) (win->_flags & A_ATTR1)
- #define is_attr2on(win) (win->_flags & A_ATTR2)
- #define is_attr3on(win) (win->_flags & A_ATTR3)
- #define is_attr4on(win) (win->_flags & A_ATTR4)
- #define is_attr5on(win) (win->_flags & A_ATTR5)
- #define is_attr6on(win) (win->_flags & A_ATTR6)
- #define is_attr7on(win) (win->_flags & A_ATTR7)
- #define is_attr8on(win) (win->_flags & A_ATTR8)
- #define is_curoff() (curscr->_flags & _CUROFF)
- #define winch(win) (win->_y[win->_cury][win->_curx])
-
- #define is_delok(w) (DL&&((w->_flags & _VSCROLL)||((w->_maxx==COLS)&&((w->_begy+w->_maxy)==LINES))))
-
- #define is_insok(w) (AL&&((w->_flags & _VSCROLL)||((w->_maxx==COLS)&&((w->_begy+w->_maxy)==LINES))))
-
- #define PROCMDS 2
- #define KEY_UNUSED (-1)
-
- /*
- * System V Release 2 curses function key defines
- */
-
- #define KEY_BREAK 0401 /* break key (unreliable) */
- #define KEY_DOWN 0402 /* The four arrow keys ... */
- #define KEY_UP 0403
- #define KEY_LEFT 0404
- #define KEY_RIGHT 0405 /* ... */
- #define KEY_HOME 0406 /* Home key (upward+left arrow) */
- #define KEY_BS 0407 /* backspace (unreliable) */
- #define KEY_F0 0410 /* Function keys. Space for 64 */
- #define KEY_F(n) (KEY_F0+(n)) /* keys is reserved. */
- #define KEY_DL 0510 /* Delete line */
- #define KEY_IL 0511 /* Insert line */
- #define KEY_DC 0512 /* Delete character */
- #define KEY_IC 0513 /* Insert char or enter insert mode */
- #define KEY_EIC 0514 /* Exit insert char mode */
- #define KEY_CLEAR 0515 /* Clear screen */
- #define KEY_EOS 0516 /* Clear to end of screen */
- #define KEY_EOL 0517 /* Clear to end of line */
- #define KEY_SF 0520 /* Scroll 1 line forward */
- #define KEY_SR 0521 /* Scroll 1 line backwards (reverse) */
- #define KEY_NPAGE 0522 /* Next page */
- #define KEY_PPAGE 0523 /* Previous page */
- #define KEY_STAB 0524 /* Set tab */
- #define KEY_CTAB 0525 /* Clear tab */
- #define KEY_CATAB 0526 /* Clear all tabs */
- #define KEY_ENTER 0527 /* Enter or send (unreliable) */
- #define KEY_SRESET 0530 /* soft (partial) reset (unreliable) */
- #define KEY_RESET 0531 /* reset or hard reset (unreliable) */
- #define KEY_PRINT 0532 /* print or copy */
- #define KEY_LL 0533 /* home down or bottom (lower left) */
- /* The keypad is arranged like this: */
- /* a1 up a3 */
- /* left b2 right */
- /* c1 down c3 */
- #define KEY_A1 0534 /* upper left of keypad */
- #define KEY_A3 0535 /* upper right of keypad */
- #define KEY_B2 0536 /* center of keypad */
- #define KEY_C1 0537 /* lower left of keypad */
- #define KEY_C3 0540 /* lower right of keypad */
- #define KEY_BACKSPACE KEY_BS
-
- #pragma pack()
-
- #endif /* _TCAP_H */
- #endif
-